{include file="public/header" /}
<style type="text/css">
    #des, #des input {
        width: 40px;
        text-align: center;
    }

    #id {
        width: 78px;
    }

    .bs-checkbox {
        width: 36px;
        height: 40px;
    }

    .fixed-table-toolbar .columns, .fixed-table-toolbar .search {
        margin-left: 0px;
        margin-top: 0px;
    }

    #title span {
        float: right;
    }

    .btn-active {
        background: #1ab394;
        color: #fff;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar">
                        <a class="btn btn-default btn-outline {if input('get.field/s') eq ''} btn-active{/if}" href="{:url('file/index')}">所有照片</a>

                        {foreach $data['type'] as $key=>$v}
                        <a class="btn btn-default btn-outline {if input('get.field/s') eq 'f.type' && input('get.value/s') eq $key} btn-active{/if}" href="{:url('file/index', ['field'=>'f.type','value' => $key])}">{$v}</a>
                        {/foreach}

                         <a class="btn btn-default btn-outline {if input('get.field/s') eq 'f.is_oneself' && input('get.value/s') eq 1} btn-active{/if}" href="{:url('file/index', ['field'=>'f.is_oneself','value' => 1])}">本人</a>
                    </div>
                    <div style="display:block;clear: both;"></div>
                    <div class="fixed-table-toolbar">
                        <form method="get" action="">
                            <div class="pull-left search">
                                <div class="columns columns-right btn-group pull-left">
                                    <select class="form-control" name="search_field">
                                        <option value="m.username" {if input('get.search_field') eq 'm.username'}selected="selected"{/if}>手机号</option>
                                        <option value="m.id" {if input('get.search_field') eq 'm.id'}selected="selected"{/if}>用户ID</option>
                                        <option value="f.id" {if input('get.search_field') eq 'f.id'}selected="selected"{/if}>文件ID</option>
                                    </select>
                                </div>
                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px"
                                            class="btn btn-default btn-outline" type="submit">搜索
                                    </button>
                                    {if input('?get.back')}
                                    <input type="hidden" name="back" value="-1" />
                                    <a class="btn btn-w-m btn-link" href="{:url('member/index')}">返回</a>
                                    {/if}
                                </div>
                                <div class="columns columns-right btn-group pull-right">
                                    <input type="text" name="date_range" id="date_range" class="form-control" placeholder="时间"
                                           value="{if !empty($name.begin_date)}{$name.begin_date}{/if}{if !empty($name.end_date)} - {$name.end_date}{/if}" />
                                </div>
                                <div class="pull-right search">
                                    <input class="form-control input-outline" type="text" name="search_value" value="{:input('get.search_value', '')}" />
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">
                            <table data-toggle="table">
                                <thead>
                                    <tr>
                                        <th data-align="center">ID</th>
                                        <th data-align="center">图片 / 视频</th>
                                        <th data-align="center">用户ID</th>
                                        <th data-align="center">手机号</th>
                                        <th data-align="center">用户昵称</th>
                                        <th data-align="center">类型</th>
                                        <th data-align="center">状态</th>
                                        <th data-align="center">时间</th>
                                        <th data-align="center">管理</th>
                                    </tr>
                                </thead>
                                <tbody>
                                {volist name="data.list" id="vo"}
                                <tr id="id{$vo.id}">
                                    <td>{$vo.id}</td>
                                    <td><a href="{$vo.url}" target="_blank"><img src="{if strpos($vo.url, '.mp4') eq false}{$vo.url}{else}__STYLE__/admin/img/video.jpg{/if}" width="40" height="40" /></a></td>
                                    <td>{$vo.member_id}</td>
                                    <td>{$vo.username}</td>
                                    <td>
                                        {if $vo.member_id eq 0}
                                          系统 & 管理员
                                        {else}
                                          {$vo.nickname|default = '--'}
                                        {/if}
                                    </td>
                                    <td>{$data.type[$vo.type]|default = '其他'}
                                        {if $vo.type==7}<br> [{if $vo.real_verify}已认证{else}待认证{/if}]{/if}
                                    </td>
                                    <td>{$data.status[$vo.status]|default = '-'}</td>
                                    <td>{if $vo.create_time gt 0}{$vo.create_time|date="Y-m-d H:i:s"}{else} - {/if}</td>
                                    <td>
                                       <div class="btn-group">
                                            <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">
                                                操作 <span class="caret"></span>
                                            </div>
                                            <ul class="dropdown-menu">
                                                {if $vo.status eq 1}
                                                <li><a onclick="audit({$vo.id}, 2)">拒绝</a></li>
                                                {/if}
                                               <li><a onclick="setOneSelf({$vo.id},{if $vo.is_oneself}0{else}1{/if})">{if $vo.is_oneself}取消本人{else}设置本人{/if}</a></li>
                                                <li><a onClick="del({$vo.id})">删除</a>
                                            </ul>
                                       </div>
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-12 pages">{$page|raw}</div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
{load href="__STYLE__/admin/plugins/bootstrap/bootstrap-table.min.css"}
{load href="__STYLE__/admin/plugins/bootstrap/bootstrap-table.min.js"}
{load href="__STYLE__/admin/plugins/bootstrap/bootstrap-table-zh-CN.min.js"}
<script type="text/javascript">
    function del(id) {
        swal_del(id, "{:url('del')}", {title:'该文件'});
    }
    //年月范围
    layui.use('laydate',function () {
        layui.laydate.render({
            elem: '#date_range',
            type: 'date',
            range: true
        });
    });
    function audit(id, status) {
        $.ajax({
            url: "{:url('file/audit')}",
            type: 'POST',
            dataType: 'JSON',
            data: {id: id, status: status},
            success: function (res) {
                if (res.status == 1) {
                    layer.msg(res.msg, {icon: 1, time: 2500}, function () {
                        window.location.reload();
                    });
                } else {
                    layer.msg(res.msg, {icon: 5, time: 3000});
                }
            },
            error: function () {
                layer.msg('网络错误', {icon: 2, time: 3000});
            }
        });
    }

    function setOneSelf(id,status) {
        $.ajax({
            url: "{:url('file/setOneSelf')}",
            type: 'POST',
            dataType: 'JSON',
            data: {id: id, status: status},
            success: function (res) {
                if (res.status == 1) {
                    layer.msg(res.msg, {icon: 1, time: 2500}, function () {
                        window.location.reload();
                    });
                } else {
                    layer.msg(res.msg, {icon: 5, time: 3000});
                }
            },
            error: function () {
                layer.msg('网络错误', {icon: 2, time: 3000});
            }
        });
    }
</script>